//
//  JAlertView.h
//  jhf
//
//  Created by 计海峰 on 2017/11/23 14:05:37.
//  Copyright © 2017年 计海峰. All rights reserved.
//

#import <UIKit/UIKit.h>

//方向，可同时支持一个或多个方向
typedef NS_OPTIONS(NSUInteger, JDirection) {
    JDirectionNone = 0,
    JDirectionTop = 1 << 0,
    JDirectionLeft = 1 << 1,
    JDirectionRight = 1 << 2,
    JDirectionBottom = 1 << 3
};


typedef NS_OPTIONS(NSUInteger, JPosition) {
    JPositionCentre = 0,
    JPositionTop = 1 << 0,
    JPositionLeft = 1 << 1,
    JPositionRight = 1 << 2,
    JPositionBottom = 1 << 3
};

typedef void(^JPressBlock)(NSInteger identify , id obj);

#import "JAlertView.h"

@class JViewConstraintModel;
@interface JAlertView : UIView

//bgview
@property (nonatomic,strong) UIView *bgView;

//block
@property (nonatomic,copy) JPressBlock block;

@property (nonatomic,assign) CGFloat animateDuration;

@property (nonatomic,assign) BOOL needBgPress;

- (void)handleBlock:(JPressBlock)block;

//动画方向
@property (nonatomic,assign) JDirection direction;

//显示
- (void)showWithView:(UIView *)view;

- (void)showWithView:(UIView *)view andMargin:(UIEdgeInsets)margin;

- (void)showWithView:(UIView *)view withPosition:(JPosition)postion;

- (void)showWithView:(UIView *)view andConstraint:(JViewConstraintModel *)cons;

//移除
- (void)removeSelf;

//单例子
+ (JAlertView *)shareInstance;

@end



/**
 contentview 1> 约束 -1表示 不添加约束    2>  其它值表示约束    3> -1 约束可传 -1.000000000000001
 */
@interface JViewConstraintModel : NSObject

//宽
@property (nonatomic, assign) CGFloat width;

//高
@property (nonatomic, assign) CGFloat height;

//顶部
@property (nonatomic, assign) CGFloat top;

//左
@property (nonatomic, assign) CGFloat left;

//底部
@property (nonatomic, assign) CGFloat bottom;

//右
@property (nonatomic, assign) CGFloat right;

//横向居中 偏移
@property (nonatomic, assign) CGFloat centreX;

//垂直居中 偏移
@property (nonatomic, assign) CGFloat centreY;


/**
 初始化

 @param w width
 @param h height
 @param t top
 @param l left
 @param b bottom
 @param r right
 @param x centreX
 @param y centreY
 @return 对象
 */
+ (JViewConstraintModel *)initWithW:(CGFloat)w H:(CGFloat)h T:(CGFloat)t L:(CGFloat)l B:(CGFloat)b R:(CGFloat)r CentreX:(CGFloat)x CentreY:(CGFloat)y;

@end

